package com.stream;

import java.util.ArrayList;
import java.util.List;

public class ListUtil {

	public static <T> List<List<T>> dealList(List<T> list,int size){
		List<List<T>> obj = new ArrayList<>();
		List<T> temp = new ArrayList<T>();
		for(int i=0,len=list.size();i<len;i++){
			temp.add(list.get(i));
			if((i+1)%size == 0||i == (len-1)){
				obj.add(temp);
				temp = new ArrayList<>();
			}
		}
		return obj;
	}
	public static void main(String[] args) {
		List<String> list = new ArrayList<>();
		for(int i=0;i<12;i++){
			list.add("str:"+i);
		}
		System.out.println(list.size());
		List<List<String>> obj = new ArrayList<>();
		int size = 100;
		List<String> temp = new ArrayList<>();
		for(int i=0,len=list.size();i<len;i++){
			temp.add(list.get(i));
			if((i+1)%size == 0||i == (len-1)){
				obj.add(temp);
				temp = new ArrayList<>();
			}
		}
		
		System.out.println(obj.size()+obj.get(0).toString());
	}
	
}
